#include "xNodeType_VM_Factory.h"
//#include "vm/rtvm/x_autounfold_rtvm.h"
//#include "vm/cpvm/x_bin_tree_cpvm.h"
//#include "vm/cpvm/x_pic_cpvm.h"
//#include "vm/cpvm/x_queue_cpvm.h"
//#include "vm/cpvm/x_graph_cpvm.h"
//#include "vm/cpvm/x_rows_in_block_cpvm.h"
//#include "vm/cpvm/x_electric_tower_cpvm.h"
//#include "vm/cpvm/x_flat_map_cpvm.h"
#include "ubvm_cube.h"
#include "ubvm_sphere.h"
#include "ubvm_container.h"
#include "ubvm_autounford_container.h"
#include "ubvm_wrapper.h"
#include "ubvm_block.h"
#include "ubvm_torus.h"
#include "ubvm_partial_torus.h"
#include "ubvm_cone.h"
#include "ubvm_cylinder.h"
#include "ubvm_pie.h"
#include "ubvm_text.h"
#include "ubvm_line.h"
#include "ubvm_laser.h"
#include "ubrvm_laser.h"
#include "ubrvm_line.h"
#include "ubrvm_autounfold.h"
#include "ubrvm_orbit.h"
#include "ubvm_2darray.h"
#include "ubvm_freestyle.h"
#include "ubvm_quadrilateral.h"
#include "vmLibrary.h"

DIVA_VM * xNodeType_VM_Factory::createVM(int id, xParameterPack xpp){
	
	/*
	if(id == vmLibrary::vm_ids["BINARY_TREE_NODE_CPVM"])				return new x_bin_tree_cpvm(xpp);
	else if(id == vmLibrary::vm_ids["BOOL_GREEN_RED_BALL_PTVM"])		return new x_green_red_bool_ptvm(xpp);
	else if(id == vmLibrary::vm_ids["REF_LASER_RTVM"])					return new x_laser_rtvm(xpp);
	else if(id == vmLibrary::vm_ids["INT_CUBOID_PTVM"]) 				return new x_cuboid_int_ptvm(xpp);
	else if(id == vmLibrary::vm_ids["PIC_CPVM"])						return new x_pic_cpvm(xpp);
	else if(id == vmLibrary::vm_ids["AUTO_UNFOLD_RTVM"])				return new x_autounfold_rtvm(xpp);
	else if(id == vmLibrary::vm_ids["BLOCK_LISTINROW_CPVM"])			return new x_rows_in_block_cpvm(xpp);
	else if(id == vmLibrary::vm_ids["REF_LINE_RTVM"] )					return new x_line_rtvm(xpp);
	else if(id == vmLibrary::vm_ids["INT_RGB_CUBE_PTVM"])				return new x_rgb_cube_ptvm(xpp);
	else if(id == vmLibrary::vm_ids["QUEUE_CPVM"])						return new x_queue_cpvm(xpp);
	else if(id == vmLibrary::vm_ids["ORBIT_RTVM"])						return new Orbit_rtvm(xpp);
	else if(id == vmLibrary::vm_ids["ORBIT_NOENT_RTVM"])				return new Orbit_rtvm_NoEntity(xpp);
	else if(id == vmLibrary::vm_ids["GRAPH_CPVM"])						return new x_graph_cpvm(xpp);
	else if(id == vmLibrary::vm_ids["TEXTUAL_PTVM"])					return new x_textual_ptvm(xpp);
	else if(id == vmLibrary::vm_ids["ROWS_IN_BLOCK_CPVM"])				return new x_rows_in_block_cpvm(xpp);
	else if(id == vmLibrary::vm_ids["DOUBLE_CUBOID_PTVM"]) 				return new x_cuboid_double_ptvm(xpp);
	else if(id == vmLibrary::vm_ids["DISH_PTVM"])					    return new x_dish_ptvm(xpp);
	else if(id == vmLibrary::vm_ids["ELECTRIC_TOWER_CPVM"])				return new x_electric_tower_cpvm(xpp);
	else if(id == vmLibrary::vm_ids["TOWER_PTVM"])						return new x_tower_ptvm(xpp);
	else if(id == vmLibrary::vm_ids["FLAT_MAP_CPVM"])					return new x_flat_map_cpvm(xpp);
	else if(id == vmLibrary::vm_ids["CUBE_UBVM"])						return new ubvm_cube(xpp);
	else {
		   assert(false);
		   return NULL ;
	}
	*/
	string vmname = vmLibrary::instance().get_name_by_id( id );
	if (vmname == "CUBE_UBVM") return new ubvm_cube(xpp); 
	else if (vmname == "SPHERE_UBVM") return new ubvm_sphere(xpp);
	else if (vmname == "CONTAINER_UBVM") return new ubvm_container(xpp);
	else if (vmname == "AUTOUNFORD_CONTAINER_UBVM") return new ubvm_autounford_container(xpp);
	else if (vmname == "WRAPPER_UBVM") return new ubvm_wrapper(xpp);
	else if (vmname == "BLOCK_UBVM") return new ubvm_block(xpp);
	else if (vmname == "TORUS_UBVM") return new ubvm_torus(xpp);
	else if (vmname == "PARTIAL_TORUS_UBVM") return new ubvm_partial_torus(xpp);
	else if (vmname == "CONE_UBVM") return new ubvm_cone(xpp);
	else if (vmname == "PIE_UBVM") return new ubvm_pie(xpp);
	else if (vmname == "CYLINDER_UBVM") return new ubvm_cylinder(xpp);
	else if (vmname == "TEXT_UBVM") return new ubvm_text(xpp);
	else if (vmname == "LINE_UBVM") return new ubvm_line(xpp);
	else if (vmname == "LASER_UBVM") return new ubvm_laser(xpp);
	//else if (vmname == "LINE_REFERENCE") return new line_ref(xpp);
	else if (vmname == "LASER_REFERENCE") return new ubrvm_laser(xpp);
	else if (vmname == "LINE_REFERENCE") return new ubrvm_line(xpp);
	else if (vmname == "AUTOUNFOLD_REFERENCE") return new ubrvm_autounfold(xpp);
	else if (vmname == "ORBIT_REFERENCE") return new ubrvm_orbit(xpp);
	else if (vmname == "2DARRAY_UBVM") return new ubvm_2darray(xpp);
	else if (vmname == "FREESTYLE_UBVM") return new ubvm_freestyle(xpp);
	else if (vmname == "QUADRILATERAL_UBVM") return new ubvm_quadrilateral(xpp);
	else {
		assert( !"VM not found" );
		return NULL ;
	}
}